using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Common.Pool
{
    public class CompoentPoolObj<T> : PoolObject<T> where T : UnityEngine.Behaviour
    {
        public CompoentPoolObj(T target) : base(target)
        {
        }
        public override PoolObject<T> Clone()
        {
            var newTarget = Target.gameObject.AddComponent<T>();
            Debug.Log("clone");
            return new CompoentPoolObj<T>(newTarget);
        }
        public override void OnSpawn()
        {
            Target.enabled = true;
            Debug.Log("OnSpawn");
        }
        public override void OnRecycle()
        {
            Target.enabled = false;
            Debug.Log("OnRecycle");
        }
        public override void OnDestory()
        {
            GameObject.Destroy(Target);
        }
    }
}

